		app.controller("intheatersCtrl",["$scope","$routeParams","$route","ajaxjsonp",function($scope,$routeParams,$route,ajaxjsonp){
					
//			$http.jsonp('http://api.douban.com/v2/movie/in_theaters')
//				 .then(function(res){
//				        // 成功的回调函数
//				         console.log(res.data)
//				        $scope.data = res.data
//				      })
//			
            
            $scope.page = +($routeParams.id || 1);
			$scope.start = $scope.page * 5 - 5;
			$scope.count = 5;
			
			$scope.loading = true;
			ajaxjsonp.jsonp({
				  url : 'http://api.douban.com/v2/movie/'+$routeParams.in_theaters,
			        jsonp : 'callback',
			        data:{start:$scope.start,count:$scope.count,q:$routeParams.q},
			        success:function(data){
//			        	console.log(data)
			        	$scope.data = data;
			        	$scope.total = data.total
			        	$scope.totalpage =   Math.ceil($scope.total / $scope.count);
			        	$scope.loading = false;
			        	$scope.$apply();
			        	
			        }
			})
			
			
			$scope.getId = function ( page ){
             
            	 if(page > $scope.totalpage  || page < 1 )  return
             
				$route.updateParams({id:page})
				
			}
					
		}])